using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DevExpress.ExpressApp.DC;
using DevExpress.Persistent.Base;
using DevExpress.Persistent.BaseImpl;
using DevExpress.Xpo;
using DevExpress.ExpressApp.ConditionalAppearance;
using Ascent.QiPei.Module.BusinessObjects.Base;
namespace Ascent.QiPei.Module.BusinessObjects.Sales
{
  [DefaultClassOptions]
  [DevExpress.Persistent.Base.NavigationItemAttribute("销售管理")]
  [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("销售订单")]
  public partial class SaleOrder : DevExpress.Persistent.BaseImpl.BaseObject
  {
    private System.DateTime _sODate;
    private System.Single _hasReceivedAmount;
    private System.DateTime _createDate;
    private System.String _createUser;
    private System.Single _gargoServiceCharge;
    private System.Single _gargoFare;
    private Ascent.QiPei.Module.BusinessObjects.Base.Customer _customer;
    private Ascent.QiPei.Module.BusinessObjects.Base.GargoTeminal _gargoTeminal;
    private System.Single _receivedCollection;
    private System.Single _receivedUnpaid;
    private System.Single _receivedRemitCash;
    private System.Single _debtAmount;
    private System.String _telphone;
    private Ascent.QiPei.Module.BusinessObjects.Enums.OrderStatusType _soStatus;
    private System.Single _receivedCash;
    private System.Int16 _taxRate;
    private System.Int16 _discount;
    private System.Boolean _taxIncluded;
    private System.Single _totalAmount;
    private System.Single _amount;
    private System.Single _taxAmount;
    private System.Single _discountAmount;
    private System.String _remarks;
    private System.String _invoiceNumber;
    private System.DateTime _timeOfPayment;
    private Ascent.QiPei.Module.BusinessObjects.Base.Employee _employee;
    private System.DateTime _deliveryDate;
    private System.String _sOCode;
    public SaleOrder(DevExpress.Xpo.Session session)
      : base(session)
    {
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("销售单号")]
    [Appearance("已审核", AppearanceItemType = "ViewItem", TargetItems = "*", Context = "ListView", BackColor = "Red", Criteria = "SoStatus='已审核'")]
    [DevExpress.Persistent.Base.VisibleInLookupListViewAttribute(false)]
    public System.String SOCode
    {
      get
      {
        return _sOCode;
      }
      set
      {
        SetPropertyValue("SOCode", ref _sOCode, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("交货日期")]
    public System.DateTime DeliveryDate
    {
      get
      {
        return _deliveryDate;
      }
      set
      {
        SetPropertyValue("DeliveryDate", ref _deliveryDate, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("开单日期")]
    public System.DateTime SODate
    {
      get
      {
        return _sODate;
      }
      set
      {
        SetPropertyValue("SODate", ref _sODate, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("客户")]
    public Ascent.QiPei.Module.BusinessObjects.Base.Customer Customer
    {
      get
      {
        return _customer;
      }
      set
      {
        SetPropertyValue("Customer", ref _customer, value);
        //if (_customer == value)
        //  return;
        //Ascent.QiPei.Module.BusinessObjects.Base.Customer prevCustomer = _customer;
        //_customer = value;
        //if (IsLoading)
        //  return;
        //if (prevCustomer != null && prevCustomer.SaleOrder == this)
        //  prevCustomer.SaleOrder = null;
        //if (_customer != null)
        //  _customer.SaleOrder = this;
        //OnChanged("Customer");
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("销售代表")]
    public Ascent.QiPei.Module.BusinessObjects.Base.Employee Employee
    {
      get
      {
        return _employee;
      }
      set
      {
        SetPropertyValue("Employee", ref _employee, value);
        //if (_employee == value)
        //  return;
        //Ascent.QiPei.Module.BusinessObjects.Base.Employee prevEmployee = _employee;
        //_employee = value;
        //if (IsLoading)
        //  return;
        //if (prevEmployee != null && prevEmployee.SaleOrder == this)
        //  prevEmployee.SaleOrder = null;
        //if (_employee != null)
        //  _employee.SaleOrder = this;
        //OnChanged("Employee");
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("付款期限")]
    public System.DateTime TimeOfPayment
    {
      get
      {
        return _timeOfPayment;
      }
      set
      {
        SetPropertyValue("TimeOfPayment", ref _timeOfPayment, value);
      }
    }
    [DevExpress.Persistent.Base.ImmediatePostDataAttribute]
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("折扣%")]
    [DevExpress.Persistent.Base.VisibleInLookupListViewAttribute(false)]
    [DevExpress.Persistent.Base.VisibleInListViewAttribute(false)]
    public System.Int16 Discount
    {
      get
      {
        return _discount;
      }
      set
      {
        SetPropertyValue("Discount", ref _discount, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("是否含税")]
    [DevExpress.Persistent.Base.ImmediatePostDataAttribute]
    [DevExpress.Persistent.Base.VisibleInLookupListViewAttribute(false)]
    [DevExpress.Persistent.Base.VisibleInListViewAttribute(false)]
    public System.Boolean TaxIncluded
    {
      get
      {
        return _taxIncluded;
      }
      set
      {
        SetPropertyValue("TaxIncluded", ref _taxIncluded, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("发票号码")]
    [DevExpress.Persistent.Base.VisibleInLookupListViewAttribute(false)]
    [DevExpress.Persistent.Base.VisibleInListViewAttribute(false)]
    public System.String InvoiceNumber
    {
      get
      {
        return _invoiceNumber;
      }
      set
      {
        SetPropertyValue("InvoiceNumber", ref _invoiceNumber, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("税率%")]
    [DevExpress.Persistent.Base.ImmediatePostDataAttribute]
    [DevExpress.Persistent.Base.VisibleInListViewAttribute(false)]
    [DevExpress.Persistent.Base.VisibleInLookupListViewAttribute(false)]
    public System.Int16 TaxRate
    {
      get
      {
        return _taxRate;
      }
      set
      {
        SetPropertyValue("TaxRate", ref _taxRate, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("备注")]
    [DevExpress.Persistent.Base.VisibleInListViewAttribute(false)]
    [DevExpress.Persistent.Base.VisibleInLookupListViewAttribute(false)]
    public System.String Remarks
    {
      get
      {
        return _remarks;
      }
      set
      {
        SetPropertyValue("Remarks", ref _remarks, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("合计金额")]
    [DevExpress.Persistent.Base.ImmediatePostDataAttribute]
    public System.Single TotalAmount
    {
      get
      {
        return _totalAmount;
      }
      set
      {
        SetPropertyValue("TotalAmount", ref _totalAmount, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("折扣金额")]
    [DevExpress.Persistent.Base.ImmediatePostDataAttribute]
    public System.Single DiscountAmount
    {
      get
      {
        return _discountAmount;
      }
      set
      {
        SetPropertyValue("DiscountAmount", ref _discountAmount, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("税金金额")]
    [DevExpress.Persistent.Base.ImmediatePostDataAttribute]
    public System.Single TaxAmount
    {
      get
      {
        return _taxAmount;
      }
      set
      {
        SetPropertyValue("TaxAmount", ref _taxAmount, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("应收金额")]
    [DevExpress.Persistent.Base.ImmediatePostDataAttribute]
    public System.Single Amount
    {
      get
      {
        return _amount;
      }
      set
      {
        SetPropertyValue("Amount", ref _amount, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("现金")]
    public System.Single ReceivedCash
    {
      get
      {
        return _receivedCash;
      }
      set
      {
        SetPropertyValue("ReceivedCash", ref _receivedCash, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("汇款")]
    public System.Single ReceivedRemitCash
    {
      get
      {
        return _receivedRemitCash;
      }
      set
      {
        SetPropertyValue("ReceivedRemitCash", ref _receivedRemitCash, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("挂帐")]
    public System.Single ReceivedUnpaid
    {
      get
      {
        return _receivedUnpaid;
      }
      set
      {
        SetPropertyValue("ReceivedUnpaid", ref _receivedUnpaid, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("代收")]
    public System.Single ReceivedCollection
    {
      get
      {
        return _receivedCollection;
      }
      set
      {
        SetPropertyValue("ReceivedCollection", ref _receivedCollection, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("运费")]
    public System.Single GargoFare
    {
      get
      {
        return _gargoFare;
      }
      set
      {
        SetPropertyValue("GargoFare", ref _gargoFare, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("手续费")]
    public System.Single GargoServiceCharge
    {
      get
      {
        return _gargoServiceCharge;
      }
      set
      {
        SetPropertyValue("GargoServiceCharge", ref _gargoServiceCharge, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("货运站")]
    public Ascent.QiPei.Module.BusinessObjects.Base.GargoTeminal GargoTeminal
    {
      get
      {
        return _gargoTeminal;
      }
      set
      {
        SetPropertyValue("GargoTeminal", ref _gargoTeminal, value);
        //if (_gargoTeminal == value)
        //  return;
        //Ascent.QiPei.Module.BusinessObjects.Base.GargoTeminal prevGargoTeminal = _gargoTeminal;
        //_gargoTeminal = value;
        //if (IsLoading)
        //  return;
        //if (prevGargoTeminal != null && prevGargoTeminal.SaleOrder == this)
        //  prevGargoTeminal.SaleOrder = null;
        //if (_gargoTeminal != null)
        //  _gargoTeminal.SaleOrder = this;
        //OnChanged("GargoTeminal");
      }
    }
    [DevExpress.Xpo.AssociationAttribute("SaleOrderDetails-SaleOrder")]
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("销售明细")]
    public XPCollection<Ascent.QiPei.Module.BusinessObjects.Sales.SaleOrderItems> SaleOrderItems
    {
      get
      {
        return GetCollection<Ascent.QiPei.Module.BusinessObjects.Sales.SaleOrderItems>("SaleOrderItems");
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("销售单状态")]
    [DevExpress.Persistent.Base.VisibleInLookupListViewAttribute(false)]
    public Ascent.QiPei.Module.BusinessObjects.Enums.OrderStatusType SoStatus
    {
      get
      {
        return _soStatus;
      }
      set
      {
        SetPropertyValue("SoStatus", ref _soStatus, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("客户电话")]
    public System.String Telphone
    {
      get
      {
        return _telphone;
      }
      set
      {
        SetPropertyValue("Telphone", ref _telphone, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("欠款金额")]
    public System.Single DebtAmount
    {
      get
      {
        return _debtAmount;
      }
      set
      {
        SetPropertyValue("DebtAmount", ref _debtAmount, value);
      }
    }
    [System.ComponentModel.BrowsableAttribute(false)]
    public System.String CreateUser
    {
      get
      {
        return _createUser;
      }
      set
      {
        SetPropertyValue("CreateUser", ref _createUser, value);
      }
    }
    [System.ComponentModel.BrowsableAttribute(false)]
    public System.DateTime CreateDate
    {
      get
      {
        return _createDate;
      }
      set
      {
        SetPropertyValue("CreateDate", ref _createDate, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("应收帐已收金额")]
    [System.ComponentModel.BrowsableAttribute(false)]
    public System.Single HasReceivedAmount
    {
      get
      {
        return _hasReceivedAmount;
      }
      set
      {
        SetPropertyValue("HasReceivedAmount", ref _hasReceivedAmount, value);
      }
    }
  }
}
